<?php

namespace app\modules\goodslist\controllers;

use yii\web\Controller;
use common\models\Goods;
use common\models\Tools;

/**
 * 商品列表
 */
class DefaultController extends Controller
{
    /**
     * Renders the index view for the module
     * @return string
     */
    public function actionIndex()
    {
        $condition = [];
        $condition['first_cate'] = Tools::GetSafeParam('first_cate', 0, 0);
        $condition['second_cate'] = Tools::GetSafeParam('second_cate', 0, 0);
        $condition['third_cate'] = Tools::GetSafeParam('third_cate', 0, 0);
        
        
        
        $page_no = Tools::GetSafeParam('page_no', 1, 0);
        
        $data = Goods::getGoodsList($condition,$page_no);
        
        $page = Tools::showCmPager($page_no, $data['perpage'], $data['total'],$condition);
        
//        echo "<pre>"; print_r($data);exit;
        return $this->render('index',['data'=>$data,'page'=>$page]);
    }
}
